//
//  UIButton+Extension.swift
//  YJWeiBo
//
//  Created by Jim1024 on 2017/1/18.
//  Copyright © 2017年 Jim1024. All rights reserved.
//

import UIKit

extension UIButton {
    /**
     快速创建按钮
     
     - parameter title:        标题
     - parameter imageName:    图片名称
     - parameter bkgImageName: 背景图片名称
     - parameter textColor:    按钮标题颜色
     - parameter textFont:     按钮标题文字大小
     
     - returns: 按钮
     */
     convenience init(title: String, imageName: String, bgImageName: String = "timeline_card_bottom_background", textColor: UIColor = UIColor.lightGray, textFont: CGFloat = YJStatusCellBottomDefaultFontSize) {
        self.init()
        
        // 设置
        self.setBackgroundImage(UIImage(named: bgImageName), for: .normal)
        self.setBackgroundImage(UIImage(named: "\(bgImageName)_highlighted"), for: .highlighted)
        self.setImage(UIImage(named: imageName), for: .normal)
        
        self.setTitle(title, for: .normal)
        self.setTitleColor(textColor, for: .normal)
        self.titleLabel?.font = UIFont.systemFont(ofSize: textFont)
        
    }
}
